import importlib


def import_dependency(name: str):
    msg = (
        f"Missing optional dependency '{name}'"
        f"Use pip or conda to install {name}."
    )
    try:
        module = importlib.import_module(name)
    except ImportError:
        raise ImportError(msg) from None

    return module
